From: Jan Beulich Date: Mon, 4 May 2020 09:51:18 +0000 (+0200) Subject: xenoprof: drop unused struct xenoprof fields X-Git-Tag: archive/raspbian/4.14.0+80-gd101b417b7-1+rpi1^2~63^2~316 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https://%22%22/%22http:/www.example.com/cgi/%22https:/%22%22?a=commitdiff_plain;h=e83719b53a9be1c69033b3ded8051d47e3dadab8;p=xen.git xenoprof: drop unused struct xenoprof fields Both is_primary and domain_ready are only ever written to. Drop both fields and restrict structure visibility to just the one involved CU. While doing so (and just for starters) make "is_compat" properly bool. Signed-off-by: Jan Beulich Reviewed-by: Wei Liu --- diff --git a/xen/common/xenoprof.c b/xen/common/xenoprof.c index 3dad5dfb38..8a78957fbe 100644 --- a/xen/common/xenoprof.c +++ b/xen/common/xenoprof.c @@ -33,6 +33,23 @@ static DEFINE_SPINLOCK(pmu_owner_lock); int pmu_owner = 0; int pmu_hvm_refcount = 0; +struct xenoprof_vcpu { + int event_size; + xenoprof_buf_t *buffer; +}; + +struct xenoprof { + char *rawbuf; + int npages; + int nbuf; + int bufsize; + int domain_type; +#ifdef CONFIG_COMPAT + bool is_compat; +#endif + struct xenoprof_vcpu *vcpu; +}; + static struct domain *active_domains[MAX_OPROF_DOMAINS]; static int active_ready[MAX_OPROF_DOMAINS]; static unsigned int adomains; @@ -259,7 +276,6 @@ static int alloc_xenoprof_struct( d->xenoprof->npages = npages; d->xenoprof->nbuf = nvcpu; d->xenoprof->bufsize = bufsize; - d->xenoprof->domain_ready = 0; d->xenoprof->domain_type = XENOPROF_DOMAIN_IGNORED; /* Update buffer pointers for active vcpus */ @@ -327,7 +343,6 @@ static int set_active(struct domain *d) if ( x == NULL ) return -EPERM; - x->domain_ready = 1; x->domain_type = XENOPROF_DOMAIN_ACTIVE; active_ready[ind] = 1; activated++; @@ -348,7 +363,6 @@ static int reset_active(struct domain *d) if ( x == NULL ) return -EPERM; - x->domain_ready = 0; x->domain_type = XENOPROF_DOMAIN_IGNORED; active_ready[ind] = 0; active_domains[ind] = NULL; @@ -655,12 +669,7 @@ static int xenoprof_op_get_buffer(XEN_GUEST_HANDLE_PARAM(void) arg) return ret; } else - { - d->xenoprof->domain_ready = 0; d->xenoprof->domain_type = XENOPROF_DOMAIN_IGNORED; - } - - d->xenoprof->is_primary = (xenoprof_primary_profiler == d); ret = share_xenoprof_page_with_guest( d, virt_to_mfn(d->xenoprof->rawbuf), d->xenoprof->npages); diff --git a/xen/include/xen/xenoprof.h b/xen/include/xen/xenoprof.h index f1f9446bd5..35f3ea107b 100644 --- a/xen/include/xen/xenoprof.h +++ b/xen/include/xen/xenoprof.h @@ -40,25 +40,6 @@ typedef union { } xenoprof_buf_t; #endif -struct xenoprof_vcpu { - int event_size; - xenoprof_buf_t *buffer; -}; - -struct xenoprof { - char *rawbuf; - int npages; - int nbuf; - int bufsize; - int domain_type; - int domain_ready; - int is_primary; -#ifdef CONFIG_COMPAT - int is_compat; -#endif - struct xenoprof_vcpu *vcpu; -}; - #ifndef CONFIG_COMPAT #define XENOPROF_COMPAT(x) 0 #define xenoprof_buf(d, b, field) ACCESS_ONCE((b)->field)